import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { ConfigService } from './config.service';
import { Singlepage } from '../model/singlepage';

@Injectable()
export class SinglepageService {

  constructor(
    private http:HttpClient,
    private config:ConfigService
  ) { }

  private addSinglepageUrl=this.config.host+"/manage/addSinglepagelist";
  addSinglepage(singlepage:Singlepage){
    return this.http.post(this.addSinglepageUrl,singlepage).toPromise();
  }

  private updateSinglepageUrl=this.config.host+"/manage/updateSinglepagelist";
  updateCarousel(singlepage:Singlepage){
    return this.http.post(this.updateSinglepageUrl,singlepage).toPromise();

  }

  private getSinglepageListUrl=this.config.host+"/manage/getSinglepagelistList";
  getSinglepageList(){
  
  return this.http.get(this.getSinglepageListUrl).toPromise();
  }

  private getSinglepageUrl=this.config.host+"/manage/getSinglepagelist";
  getSinglepage(id:string){
    let p={
      "singlepageid":id
    }
    return this.http.post(this.getSinglepageUrl,p).toPromise();
  }

  private deleteSinglepageUrl=this.config.host+"/manage/deleteSinglepagelist";
  deleteSinglepage(id:string){
      let p={
        "singlepageid":id
      }
      return this.http.post(this.deleteSinglepageUrl,p).toPromise();
    }

}
